Search Results: "Nico Golde"

26 March 2008

Nico Golde: streaming from your fileserver using mpd and icecast

My mobile music player is often missing the files I want to hear right now if I'm under way because my music collection is too big to fit on it.
Long time ago I used gnump3d which seems to be unmaintained in Debian for quite some time and then I often listened to some live streams, network connections are available nearly everywhere.
But I always wanted my own live stream with music I want to hear. There are several solutions out there for this task but they all require the creation of a playlist before the streaming starts.

Fortunately mpd provides the possibility to define different output targets and also one for streaming to a shoutcast or compatible server like icecast.

So after apt-get install mpd icecast2 (on a Debian box) you have to edit /etc/mpd.conf
There is not much to do, be sure to set music_directory to the place your music is located and the configure the output part.
Add the following to your mpd.conf and adapt some values:
  1. audio_output {
  2.         type "shout"
  3.         name "foobar stream"
  4.         port "8000"
  5.         host "localhost"
  6.         format  "44100:16:2"
  7.         mount "/stream.ogg"
  8.         password "somepass"
  9.         quality "2"
  10.         user "source"
  11. }

The type defines that this output will be streamed to a shoutcast target. The name will be displayed by the client you use to play your stream. 8000 is the port icecast2 will listen on host "localhost" (in this example the icecast2 server is on the same host). format specifies the audio format of the stream, the first number is the sample rate in Hz, the second number is the number of bits per sample and the last number defines the number of channels (2 is stereo here). Those values should work for most of you. mount specifies the path under which the stream is available later from the server root, in this example http://localhost:8000/stream.ogg.
quality defines the ogg encoding "quality". You can also specify the bitrate instead of it. The user and password values are used to authenticate mpd at the source input for icecast2.

There seems to be a bug in the 0.13 release (which is also in Debian) of mpd that prevents this from working. I don't know the details about this bug but adding
  1. audio_output {
  2.         type "alsa"
  3.         name "fake out"
  4.         driver "null"
  5. }
fixes it.

Make sure to set START_MPD=true in /etc/default/mpd to enable mpd.
That's all that needs to be done for mpd.

The next step is to edit /etc/icecast2/icecast.xml.
The default configuration nearly ready to use. Configure the authentication part:
  1. <authentication>
  2.       <source-password>somepass</source-password>
  3.       <admin-user>admin</admin-user>
  4.       <admin-password>someadminpass</admin-password>
  5. </authentication>

The source password is the one we specified in the mpd configuration. This is needed to authenticate mpd with icecast. source is the default user name icecast uses here. Additionally we define an admin-user that can be used to add users to icecast later because we want to protect the stream by a username and a password.
Then set
  1. <hostname>you.somehost.org</hostname>
.
This hostname is used to generate URLs in icecast that a user receives.

Because we want a very simple authentication for the stream we need to add some options for the mount (/stream.ogg):
  1. <mount>
  2.     <mount-name>/stream.ogg</mount-name>
  3.  
  4.     <max-listeners>1</max-listeners>
  5.     <authentication type="htpasswd">
  6.             <option name="filename" value="/etc/icecast2/htpasswd"/>
  7.             <option name="allow_duplicate_users" value="0"/>
  8.     </authentication>
  9.     <on-connect>/home/icecast/bin/stream-start</on-connect>
  10.     <on-disconnect>/home/icecast/bin/stream-stop</on-disconnect>
  11. </mount>

I think the xml tags are pretty much self-explanatory. Keep in mind to set the filename to a location the icecast daemon has access to, that's why I used /etc/icecast2. Then you can add users with htpasswd or using the web interface on port 8000 and add a user there.

The last thing to do is to adjust the <alias source="/" dest="/status.xsl"/> setting. Change status.xsl to auth.xsl people need to authenticate if they connect to the web interface before seeing the stream information.

Now you can login via ssh on your home server and use your favorite mpd client to configure playlists on the fly, I use ncmpc for this. Of course the authentication is not secure, people who sniff your traffic can see your login data.
One thing to keep in mind is to restart mpd after restarting icecast otherwise mpd will hang and not continue to stream, this seems to be a bug.

After routing through your NAT, you should be able to play your stream via http://you.somehost.org:8000/stream.ogg.

2 February 2008

Nico Golde: security vs. private illustrated


[via tim]

Nico Golde: security vs. privacy illustrated


[via tim]

26 January 2008

Nico Golde: Debian Eeepc

Asus Eeepc 701 4G
Yesterday I got an Asus EeePC and I'm really impressed by it. One of the hardware pieces where I thought you get exactly what you pay for it.

So far I ripped off the Xandros installation. While it may fit some users it is a really stripped down installation, you can't actually do much with it. Instead I gave the DebianEeePC project a try. The installation was pretty straight forward like described in the wiki. Put the installer img on a USB stick together with the network driver and install :-)

Most things are working like they are supposed to work, even the webcam and suspend works. Yay!

However some things don't work yet. For example acpi reports the remaining capacity in percentage rather than a real capacity in mAh. You just have something like 100 mAh in your proc which means 100%. This is really annoying, while it works to show the remaining percentage you can't calculate the remaining time. An additional deficit of this is that it is only capable of reporting this in steps of 10 here (until you are under 10% then it gets a bit more precise). This seems to be a BIOS or a battery firmware problem.

Another thing is that nearly all special keys do not work with unmodified acpi-support because the event ids don't match :-(
For some strange reason asus-brn-up.sh is always executed no matter what fn key you use and even if another script like voldownbt.sh get executed as well.

Apart from this I am really happy with the device, I get a working X desktop with openbox in 25 seconds and even the often criticized small screen is not that small in my opinion. A bigger problem is the keyboard. If you have big fingers I think its not fun to type on it, the keys are extremely small.

So far, thanks to everyone for the efforts put in DebianEeepc to make this possible!

See tuxmobil for some other collected installation reports.

UPDATE: it takes like 3 hours to charge the battery while it's switched on which somehow sucks.

11 December 2007

Nico Golde: grml-paste

Today mika mentioned in the #grml channel that it would be nice to have a command line tool to paste to the online paste bot.

I wrote a small ruby script for this today. Since it is pretty easy to adapt it for other paste bots like the Debian paste bot on paste.debian.net and mika reads this weblog as far as I know, the result is:
http://nion.modprobe.de/grml-paste

1 October 2007

Nico Golde: Archlinux leader steps back

Just read that after 6 years the leader(Judd Vinet) of the ArchLinux distribution will step down from his role.
he reason for this is that I do not have the time to devote towards a leadership role in a project the size of Arch Linux, and Arch deserves someone who does.

Referring to his post the new leader will be Aaron Griffin.

[via archlinux.org]

17 September 2007

Miriam Ruiz: Storing data in $HOME directory

When packaging games, one of the operations I often have to do to the source code is modifying it so that it uses absolute file and directory names instead of relative ones. When coders develop for Windows, or when they develop their games to be able to play them from their home directory, they just would go that way and won’t care about it, but when the idea is installing the files in the system, the Filesystem Hierarchy Standard (FHS) must be respected, and thus things will need to be place in their proper directories. For read-only files, this is not a big deal, all that has to be done is replacing the relative file name in the file opening commands with the absolute one, doing fopen(”/usr/share/games/package/dir/file”) instead of fopen(”dir/file”). I usually prefer to do it like fopen(DATADIR “/dir/file”) and set DATADIR from the Makefile, with a -DDATADIR=\”/usr/share/games/package\” switch added to the CFLAGS, and maybe also setting it inside the code if it’s not previously defined (#ifndef and so). There are some files and directories in which doing this is not possible, because they want read-write permissions. This files include saving the configuration, hiscores, new levels created with the game editor, game saves and so. They might be moved to some directory under “/var/lib/”, and create a new group en the system so that it’s writable, and so on. I don’t like that approach a single bit. I prefer to move all tthat data to the user’s directory. This is not as straightforward as it was for read-only data, but it’s not really that difficult anyway. It would be more or less like:
#ifndef _WIN32
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <limits.h>
#include <pwd.h>
#include <fcntl.h>
#include <sys/stat.h>
#include <sys/types.h>
#endif
#ifndef _WIN32
char file[PATH_MAX];
char *home;
struct passwd *passwd;
if (!getuid()   !(home = getenv("HOME"))) 
passwd = getpwuid (getuid());
home=passwd->pw_dir;
if (!home) 
fprintf(stderr, "$HOME is not defined.n");
exit(-1)
 
 
if (strlen(home) > PATH_MAX - sizeof("/.package/settings.ini")) 
fprintf(stderr, "$HOME is excessively long.n");
exit(-1)
 
snprintf(file, sizeof(file), "%s/.package", home);
mkdir(file, S_IRWXU   S_IRWXG   S_IROTH   S_IXOTH) == 0;
strncat(file, "/settings.ini", sizeof(file)-1);
#else
char file[21];
snprintf(file, sizeof(file), "./Data/settings.ini");
#endif
FILE *f = fopen(file, "w");
Sometimes you also need that the files are already created, you can check if they already exist with stat(), and then acting accordingly, either creating them from your C code, or maybe triggering a system() shell call whith whatever is needed.
struct stat stat_buf;
stat(file, &stat_buf);
if (stat(file, &stat_buf) == -1) 
int settings_fd = creat(file, O_WRONLY);
close(settings_fd);
 
NOTE: I’ve updated the code to add some suggestions. Thanks to Gon ri Le Bouder and Nico Golde.

15 September 2007

Nico Golde: accept the GPL on software install?

Gunnar wrote that he recently had to explicitly accept the GPL via some dialog box when doing an OpenOffice installation on windows and users are also prompted with the license agreement on the first start of the application.

Why should someone want this?
Are you also FREE to refuse this and still use the software? I mean the GPL is about distributing the software, not using it, so wtf?

2 September 2007

Nico Golde: packages.debian.org relaunch

Thanks to Joerg Jaspert and Frank Lichtenheld, the new packages.debian.org site looks way better and also seems to be really faster!

12 August 2007

Nico Golde: censorship on MSN?

Reading this and the AdiumX wiki it seems like MSN is censoring IM on the server-side.

However trying with ak who is actually using Adium X this seem to be bullshit^WFUD since our little .info test conversation worked flawlessly.

"According to communications director of MSN Sweden, Jessica B rjel, this is being done to protect users against exploits and worms spreading through the MSN Messenger service."

According to what I know about big companies they make official statements, not just some foobar in a private mail. So can someone please enlighten me? :-)

Anyway, stop crying guys, there are better alternatives.

UPDATE: They really censor!
It seems to be no FUD, it seems to be true. But it's not just the .info keyword but the whole URL. So if you send http://test.info/download.php?foo=bar this will be blocked. At least you get an error message in AdiumX, in centericq/im you don't get one :-)
Shame on Microsoft yet another time, especially for this lame approach of muddling security with obscurity, but as said there are better alternatives :-)

2 August 2007

Nico Golde: newsbeuter 0.5

I just uploaded the 0.5 release of the newsbeuter RSS feed reader to unstable.
Apart from improvements in HTML rendering and lock file handling the new release:
and finally you are also able to freely configure all key bindings.

The new filter language is pretty cool, you can now filter feeds for title, url, author etc. (see the documentation for all fields) using regular expressions like:
rssurl =~ "^http:\/\/nion\.modprobe.*", you can use the comparison operators and you are able to logical connect them.

The regexp support also enables you to killfile certain articles using the new ignore-article option, ignore-article "*" "title =~ \"SuSE\"" for example ;-P (press F to try it out)

With the notification support you are allowed to execute a specified program if a new article arrives, easy and useful for blog junkies.

Hopefully newsbeuter will become a good alternative for raggle and snownews users now as the snownews author is not really working on it anymore and raggle seems to have a stalled development as well.

2 July 2007

Nico Golde: less colors for man pages

I recently wrote how to use terminfo to get colored manpages.
Today ft came up with a nice feature of less which enables you to set termcap colors by environment variables.

Just use
export LESS_TERMCAP_mb=$'\E[01;31m'
export LESS_TERMCAP_md=$'\E[01;31m'
export LESS_TERMCAP_me=$'\E[0m'
export LESS_TERMCAP_se=$'\E[0m'
export LESS_TERMCAP_so=$'\E[01;44;33m'
export LESS_TERMCAP_ue=$'\E[0m'
export LESS_TERMCAP_us=$'\E[01;32m'

in your ~/.$SHELLrc to get the same effect without having a terminfo file.

And again for all the people writing "Install most and set it as PAGER", I know about this but using most because it has colors instead of less is just stupid since less has way more features most doesn't have. D'oh this sounds really strange :-)

UPDATE: from strcat's comment. FOO_TERMCAP can be for all programs which compiled/linked with/against termcap. See man 5 termcap for definitions.

29 June 2007

Nico Golde: stfl-0.14

Just uploaded the new version of stfl a library which implements a curses-based widget set for text terminals.

The new version of the package introduces unicode awareness of stfl (introduced in stfl 0.9, Clifford released very often : ) and the often requested packages for the bindings stfl ships, namely ruby(1.8/1.9), python, perl and spl.

The package is now going through NEW, in the meantime you can get the packages (for i386) on:
http://nion.modprobe.de/stfl/

Oh and Michael Mende is my new Co-Maintainer, also thanks to him for his help!

26 June 2007

Nico Golde: Installing molly-guard

Yeah I now did an aptitude install molly-guard (I guess most sysadmins know this tool, thanks mika for the hint) after I
halt'ed modprobe.de by accident (Strato dedicated server). I was also able to reboot my file server at home 2 times last week because of.... ssh, well and of course bad shell prompts, inattention etc.

The tool is basically a replacement for halt, reboot and shutdown to prevent such accidents. To give you an impression what this looks like:

[root@bone] /home/nion/ halt
W: molly-guard: SSH session detected!
Please type in hostname of the machine to halt:

UPDATE from madducks comment:
Please note that etch's molly-guard has a bug that hits people running shutdown -h: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=426107.

I suggest to install version 0.3-1 from testing, which shall be in etch r2 soon.

24 June 2007

Nico Golde: colored manpages

Last Friday we had a small but pretty cool linux event at University. There was also a presentation about grml and when Valentin showed that the manuals on grml are in color there were alot of people saying "wow I want that too" :-)

grml includes this feature since version 0.1 (thanks to Matthias Kopfermann who brought this up and had the initial idea) but alot of people don't know how that works (without using most as PAGER, most has some disadvantages over less).

So here is how it works:

colored manpage
$ mkdir ~/.terminfo/ && cd ~/.terminfo
Now get the terminfo description:
$ wget http://nion.modprobe.de/mostlike.txt
Now compile it using tic (the terminfo entry-description compiler)
$ tic mostlike.txt
(you may want to delete the mostlike.txt file after compiling)

And then just define an alias in the rc file of your favorite shell.
alias man="TERMINFO=~/.terminfo/ LESS=C TERM=mostlike PAGER=less man"

That's it!

If you want to modify the terminfo file, use infocmp mostlike to get the content of it later.

14 June 2007

Nico Golde: libacpi-0.1

After asking for testers of a libacpi snapshot I got a fair amount of test mails. Thanks to all the people who tried it and helped me!!

Now I finished with coding, testing and documenting everything and happy to release version 0.1 of libacpi.

It is a general purpose shared library for programs gathering ACPI information. It fully implements information about fans, batteries, ac states and thermal zones (apart from trap points).

Try it out on: http://www.ngolde.de/download/libacpi-0.1.tar.gz.

There is also an online documentation (well doxygen generated) on http://www.ngolde.de/libacpi/doc/html/.
test-libacpi.c is an example on how to write programs using libacpi.

For more information download the tarball, have a look into the manual, test-libacpi.c, README and the doxygen documentation.

The next step for me is to port yacpi to libacpi which was also the reason for libacpi since I first wanted to rewrite it and thought it might be useful to have the functionality in a library. There are not yet Debian packages for it because I am really busy at the moment so if you want to maintain it, feel free to do so.

3 June 2007

Nico Golde: debian.net domains

There are a lot of inofficial debian domains (known as debian.net domains). Some of then are really useful like changelogs.debian.net for example and others are just funny.

However I thought it might be useful to have a list of all debian.net domains so I wrote a small script.
The resulting page is on: http://people.debian.org/~nion/net-domains.html.

29 May 2007

Nico Golde: libacpi general purpose acpi library

During the last time I developed a general purpose library for ACPI on linux.
Initially I just wanted to rewrite yacpi but since there is no shared lib for acpi information I decided to
put the important stuff in a seperate library.

Before releasing it I want some people to test it because my notebook doesn't support all of the information it can gather.

If you want to help me a bit, download a snapshot from:
http://nion.modprobe.de/libacpi-unreleased.tar.gz.

Install cmake, unpack the tarball and do:
$ cmake .
$ make
$ ./test-libacpi

and send me the output of test-libacpi together with tmpfile which should be generated like:

for i in find /proc/acpi -type f ; do
    echo -e "FILE: $i ================\n" >> tmpfile
    cat $i >> tmpfile
done

via mail to:


Thanks!

UPDATE: yes I totally fucked up the install instructions and the generation of the tmpfile :-) Sorry.
And in case I didn't reply to every mail I got until now, thanks very much for you help all!

24 May 2007

Nico Golde: creating (dynamic) function call graphs

I am currently writing a general purpose shared library for acpi (more on that soon).
I was interested in having a function call graph especially to see if the interface looks somehow clean and to include it in the documentation of the library. Of course I wanted to do it with open source tools. There are several tools for static call graphs but if you want dynamic call graphs you have to use additional features of your compiler to generate a graph based on code during runtime.

The first variant I tried was using egypt a small perl script to generate a dot file. Dot (today included into graphviz? is a tool originally developed at AT&T to generate hierarchical or layered drawings of directed graphs.

So what is needed?
First install software (here on a Debian systen, egypt is not included in Debian):
$ aptitude install graphviz graphicsmagick (+ download egypt from the homepage)

Compile your software using gcc with the option -dr to dump an RTL file of the source.
Most of gcc's work is done in an intermediate representation of your code, called register transfer language (RTL). This pretty much describes the instructions in plain text and is inspired by LISP lists.
Ok, here we go:
$ gcc -dr list.c libacpi.c test.c
This generates three RTL files, for every source file one. Depending on the gcc version the names may vary, here the names are libacpi.c.00.expand list.c.00.expand and test.c.00.expand.

Now use egypt to create a dot file (I don't want one for test.c now):
$ egypt libacpi.c.00.expand list.c.00.expand dot -Gsize=100,100 -Grankdir=LR -Tps -o graph.ps
Egypt will create dot-output and by piping it to dot with -Tps -o graph.ps you get the resulting graph as a ps file. -Grankdir is used to generate a graph which runs from the left to the right, default is up-down which looks a bit strange.

Now convert the ps file into a png:
$ gm convert graph.ps graph.png
The result looks like this (looks cool huh? :-)):



The second variant I tested is a bit different and in my opinion the resulting graph looks a bit better.
The gcc commandline switch -finstrument-functions allows easy creations of call-graphs for C/C++ (script languages used but I haven't tried).
You need to compile every file with the -finstrument-functions switch. Then gcc places a call to the functions __cyg_profile_func_enter upon entering a function and __cyg_profile_func_exit on leaving a function.

Compile your sources with -g and -finstrumental-functions:
$ gcc -g -finstrumental-functions list.c libacpi.c test.c -o test
Now you need to get some source code by Sebastian Krahmer (SuSE):
$ wget http://www.suse.de/~krahmer/instrumental/instrumental.tgz && tar xvfz instrumental.tgz && cd instrumental
Compile a shared object file:
$ cc -fPIC -c instrumental.c && ld -Bshareable instrumental.o -o inst.so
This generates a shared object file you can preload with LD_PRELOAD
$ LD_PRELOAD=./inst.so test
.....

Now you will find a log.inst.dot.<pid> and log.inst.ascii.<pid> in /tmp (path can be modified in instrumental.c).
The first file is a dot file you can now create a ps and a png file with but you need to attach a closing bracket at the end of the file since the package is not
able to intercept exit() or aborts. echo ' ' >> log.inst.dot.<pid>
$ dot -Gsize=15,20 -Grankdir=LR -Tps -o graph.ps log.inst.dot.<pid> && gm convert graph.ps graph.png
The result looks like:


PDF file which scales a bit better

The other file represents the call graph in ascii:
~ [1000 1000 1000] -- main (0x8049ea4)
~ [1000 1000 1000] -- check_acpi_support (0x8048984)
~ [1000 1000 1000] -- get_acpi_version (0x8048782)
~ [1000 1000 1000] -- get_acpi_content (0x80486b4)
~ [1000 1000 1000] -- scan_acpi_value (0x8048837)
~ [1000 1000 1000] -- init_acpi_batt (0x80489d6)
~ [1000 1000 1000] -- dir_list (0x804a447)
~ [1000 1000 1000] -- new_list (0x804a23c)
~ [1000 1000 1000] -- append_node (0x804a309)
~ [1000 1000 1000] -- append_node (0x804a309)
~ [1000 1000 1000] -- read_acpi_battinfo (0x80497d3)
~ [1000 1000 1000] -- get_acpi_content (0x80486b4)
....

So both methods work but the first seems to be more useful if you want a graph for a specific file, not a specific program since you get an RTL file for each source file and you don't need all to create the dot file. The second method however looks better but has the limitation that you actually need to run the program (but that's dynamic and not static) and you can't (correct me if I miss something) create graphs for single files.

Have fun creating graphs for your favorite software and have a look into Sebastian Krahmers paper http://www.suse.de/~krahmer/instrumental/instrumental.pdf and http://www.ibm.com/developerworks/library/l-graphvis/. He also created a graph for openssh http://www.suse.de/~krahmer/ossh4.6.pdf.

18 May 2007

Nico Golde: grml-1.0 released



3 1/2 years after mika registered grml.org it's done. Congratulations! HURRAY!!!11!1!!
grml provides more than 2500 software packages! Excluding library stuff, more than 1700 packages remain. We don't ship KDE and OpenOffice, but more than 800 packages which Knoppix does not provide. You'll get sysadmins favourite tools, security- and network-related software, data recovery- and forensic-tools, LaTeX, many editors, shells, and of course many texttools.

grml provides several scripts and utils which make life easier. zsh is configured with the completion mechanism. grml-x is a wrapper for configuring and using the X window system. grml-crypt is a program that provides an easy wrapper arround cryptsetup, mkfs, losetup and mount. grml-vpn is a program to establish encrypted communication channels in a network, and so on...


Grml 1.0 release name Meilenschwein was just released.

I am tired of sitting in front of my PC for today, that's why I just link to the:
release announcement.

Next.

Previous.